{include file='common/head.html'}

<div class="layui-body">
     {if([$list])}
	<div class="layui-tab layui-tab-brief" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" lay-id="t1">公司信息</li>
         {if(session('ucode')==10001)}
         <li lay-id="t2">字段管理</li>
         <li lay-id="t3">新增字段</li>
         {/if}
	  </ul>
	  <div class="layui-tab-content">
	  	<div class="layui-tab-item layui-show">
               <form action="{url./admin/Company/index}" method="post">
	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
	  			{foreach $companylist(key,value)}
                    {if($value->type == 1)}
                    <div class="layui-form-item">
                        <label class="layui-form-label">[value->description]</label>
                        <div class="layui-input-block">
                            <input type="text" name="[value->name]" value="[value->value]" placeholder="请输入[value->description]" class="layui-input">
                        </div>
                    </div>
                    {else}
                    <div class="layui-form-item">
                        <label class="layui-form-label">[value->description]</label>
                        <div class="layui-input-inline">
                            <input type="text" name="[value->name]" id="[value->name]" value="[value->value]" placeholder="请上传[value->description]" class="layui-input">
                        </div>
                        <button type="button" class="layui-btn upload layui-btn-primary" data-des="[value->name]">
                            <i class="layui-icon">&#xe67c;</i>上传图片
                        </button>
                        <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(1,'[value->name]');"><i class="layui-icon">&#xe64a;</i>图库</a>
                        <div id="[value->name]_box" class="pic">
                            {if($value->value)}<dl><dt><img src="{SITE_DIR}[value->value]" data-url="[value->value]"></dt>
                                <dd>删除</dd>
                            </dl>{/if}
                        </div>
                    </div>
                    {/if}
                    {/foreach}
                
                    <div class="layui-form-item">
					 <div class="layui-input-block">
					    <button class="layui-btn" lay-submit>立即提交</button>
					    <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
					 </div>
				</div>
	  		</form>
	  	</div>
          <div class="layui-tab-item">
              <form action="{url./admin/Company/index}" method="post" class="layui-form">
                  <input type="hidden" name="formcheck" value="{$formcheck}">
                  <table class="layui-table center-table mt0">
                      <thead>
                          <tr>
                              <th width="60px">排序</th>
                              <th width="40px">ID</th>
                              <th style="text-align: left;">字段名称</th>
                              <th style="text-align: left;">字段描述</th>
                              <th style="text-align: left;">字段值</th>
                              <th width="60px">类型</th>
                              <th>操作</th>
                          </tr>
                      </thead>
                      <tbody>
                          {foreach $companylist(key,value)}
                          <tr>
                              <td class="table-input">
                                  <input type="hidden" name="listall[]" value="[value->id]">
                                  <input type="text" lay-ignore class="layui-input" name="sorting[]" value="[value->sorting]">
                              </td>
                              <td>[value->id]</td>
                              <td style="text-align: left;">[value->name]</td>
                              <td style="text-align: left;">[value->description]</td>
                              <td style="text-align: left;">[value->value]</td>
                              <td>[value->type]</td>
                              <td width="140px">
                                  {fun=get_btn_mod($value->id)}
                                  {fun=get_btn_del($value->id)}
                                  <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-primary [value->name]" onclick="showtext('[value->name]');" data-clipboard-text="{pboot:company[value->name]}">标签调用</a>
                              </td>
                          </tr>
                          {/foreach}
                      </tbody>
                  </table>
                  <button type="submit" name="submit" value="sorting" class="layui-btn layui-btn-sm">保存排序</button>
              </form>
          </div>
          <div class="layui-tab-item">
              <form action="{url./admin/Company/add}" method="post" class="layui-form">
                  <input type="hidden" name="formcheck" value="{$formcheck}">
                  <div class="layui-form-item">
                      <label class="layui-form-label">字段名称   <span class="layui-text-red">*</span></label>
                      <div class="layui-input-block">
                          <input type="text" name="name" required lay-verify="required" placeholder="请输入字段名称,字母、数组、下划线，如：contacts" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label class="layui-form-label">字段描述   <span class="layui-text-red">*</span></label>
                      <div class="layui-input-block">
                          <input type="text" name="description" required lay-verify="required" placeholder="请输入字段描述，如：联系人" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label class="layui-form-label">字段值</label>
                      <div class="layui-input-block">
                          <input type="text" name="value" placeholder="请输入字段值" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label class="layui-form-label">字段类型</label>
                      <div class="layui-input-block">
                          <input type="radio" name="type" value="1" title="文字" checked>
                          <input type="radio" name="type" value="2" title="图片">
                      </div>
                  </div>
                  <div class="layui-form-item">
                       <label class="layui-form-label">排序</label>
                       <div class="layui-input-block">
                          <input type="text" name="sorting" required lay-verify="required" value="255" placeholder="请输入排序"  class="layui-input">
                       </div>
                  </div>
                  <div class="layui-form-item">
                      <div class="layui-input-block">
                          <button class="layui-btn" lay-submit>立即提交</button>
                          <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
                      </div>
                  </div>
              </form>
          </div>
	  </div>
	</div>
     {/if}
     {if([$mod])}
     <div class="layui-tab layui-tab-brief" lay-filter="tab">
         <ul class="layui-tab-title">
             <li class="layui-this">字段修改</li>
         </ul>
         <div class="layui-tab-content">
             <div class="layui-tab-item layui-show">
                 <form action="{url./admin/Company/mod/id/'.[$get.id].'}{$backurl}}" method="post" class="layui-form">
                     <input type="hidden" name="formcheck" value="{$formcheck}">
                     <div class="layui-form-item">
                         <label class="layui-form-label">字段名称   <span class="layui-text-red">*</span></label>
                         <div class="layui-input-block">
                             <input type="text" name="name" value="{$company->name}" readonly="" placeholder="请输入字段名称" class="layui-input">
                         </div>
                     </div>
                     <div class="layui-form-item">
                         <label class="layui-form-label">字段描述   <span class="layui-text-red">*</span></label>
                         <div class="layui-input-block">
                             <input type="text" name="description" value="{$company->description}" placeholder="请输入字段描述" class="layui-input">
                         </div>
                     </div>
                     <div class="layui-form-item">
                         <label class="layui-form-label">字段值</label>
                         <div class="layui-input-block">
                             <input type="text" name="value" value="{$company->value}" placeholder="请输入字段值" class="layui-input">
                         </div>
                     </div>
                     <div class="layui-form-item">
                         <label class="layui-form-label">字段类型</label>
                         <div class="layui-input-block">
                             <input type="radio" name="type" value="1" title="文字" {if([$company->type]==1)}checked{/if}>
                             <input type="radio" name="type" value="2" title="图片" {if([$company->type]==2)}checked{/if}>
                         </div>
                     </div>
                     <div class="layui-form-item">
                          <label class="layui-form-label">排序</label>
                          <div class="layui-input-block">
                             <input type="text" name="sorting" value="{$company->sorting}" required lay-verify="required" value="255" placeholder="请输入排序"  class="layui-input">
                          </div>
                     </div>
                     <div class="layui-form-item">
                         <div class="layui-input-block">
                             <button class="layui-btn" lay-submit>立即提交</button>
                             <a href="{url./admin/Company/index#tab=t2}" class="layui-btn layui-btn-primary">返回</a>
                         </div>
                     </div>
                 </form>
             </div>
         </div>
     </div>
     {/if}
</div>

{include file='common/foot.html'}
